package com.guchenbo.example.mybatis;

/**
 * @Author guchenbo
 * @Date 2019/1/28.
 */
public class BookDaoTest {
//    private SqlSessionFactory sqlSessionFactory;
//
//    @Before
//    public void setUp() {
//        try {
//            String resource = "cre/sample/test/mybatis/mybatis-book-config.xml";
//            Reader reader = Resources.getResourceAsReader(resource);
//            sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader);
//        } catch (IOException e) {
//            e.printStackTrace();
//        }
//    }
//
//    @Test
//    public void testFind() {
//        SqlSession sqlSession = sqlSessionFactory.openSession();
//        try {
//            BookMapper bookMapper = sqlSession.getMapper(BookMapper.class);
//            Book book = bookMapper.findByName("Learn Java");
//            Assert.assertNotNull(book);
//            System.out.println(book);
//        } catch (Exception e) {
//            e.printStackTrace();
//        }finally {
//            sqlSession.close();
//        }
//    }
}
